home *** CD-ROM | disk | FTP | other *** search
File List | 1994-08-03 | 11.8 KB | 570 lines |
- '
- ' PluText- Quick summary of a message area
- '
- ' (c) by Peter Deane (3:622/401)
- '
- ' Whilst this program is freely distributable it is still copyright!
- ' Acknowledgement MUST be given in the program documentation
- ' for any utilisation of parts of this code in other works.
- '
- ' It must **NEVER** be sold, or had profits made from it,
- ' unless prior agreement (in writing) has been arranged with
- ' the author.
- '
- versnum$="$VER: 0.5 "
- versnum$="0.5"
- versdate$="02-Aug-94"
- versname$="PluText"
- '
- cline$=TRIM$(_dosCmd$)
- IF cline$=""
- cline$="Mail:"
- ENDIF
- '
- OPENW #0
- ~ActivateWindow(WINDOW(0))
- '
- PRINT versname$+" - V"+versnum$+" ("+versdate$+") By Peter Deane, 3:622/401"
- '
- PRINT "Please select a *.Msg directory name"
- PRINT
- '
- pickdir:
- '
- FILESELECT "*.Msg Dir","DIR",cline$,src$
- '
- IF NOT EXIST(src$)
- PRINT "Directory specified doesn't exist!"
- GOTO pickdir
- ENDIF
- '
- IF LEN(src$)>1
- IF RIGHT$(src$,1)<>"/" AND RIGHT$(src$,1)<>":"
- src$=src$+"/"
- ENDIF
- ELSE
- src$=""
- ENDIF
- '
- sourcedir$=src$
- '
- IF (sourcedir$="") OR (NOT EXIST(sourcedir$))
- PRINT
- PRINT "Error - specified directory does not exist."
- PRINT
- PRINT "Usage: "+versname$+" [MailPath]"
- GOTO finishup
- ENDIF
- '
- PRINT
- PRINT "Scanning source dir..";
- @getwhatshere(sourcedir$)
- PRINT "...done!"
- '
- PRINT
- PRINT
- PRINT "Lowater: ";lowater%
- PRINT
- PRINT "Hiwater: ";hiwater%
- PRINT
- PRINT
- '
- aa$=STR$(lowater%)
- PRINT "Start at Msg No: ";
- FORM INPUT 6 AS aa$
- '
- xx%=VAL(aa$)
- IF xx%<lowater%
- xx%=lowater%
- ENDIF
- IF xx%>hiwater%
- xx%=hiwater%
- ENDIF
- lowater%=xx%
- '
- '
- aa$=STR$(hiwater%)
- PRINT "End at Msg No: ";
- FORM INPUT 6 AS aa$
- '
- xx%=VAL(aa$)
- IF xx%>hiwater%
- xx%=hiwater%
- ENDIF
- IF xx%<lowater%
- xx%=lowater%
- ENDIF
- '
- hiwater%=xx%
- '
- '
- PRINT
- PRINT
- PRINT
- PRINT
- PRINT
- PRINT "PluText can produce three types of output:"
- PRINT
- PRINT "One-line Header Summary"
- PRINT "All Messages->ASCII"
- PRINT "Bad_Mail summary of AREA lines"
- PRINT
- ALERT 0,"What type of text?",1,"OneLine|AllMsgs|BadSum",sumtype%
- '
- grabfile:
- PRINT
- PRINT "Now enter the filename for the output text file"
- PRINT
- '
- FILESELECT "Output File","CREATE","RAM:OneLine.txt",create$
- '
- IF EXIST(create$)
- ALERT 0,create$+" exists|Overwrite?",2,"OverWrite|ReSelect",dotype%
- IF dotype%=2
- GOTO grabfile
- ENDIF
- ENDIF
- '
- OPEN "O",#2,create$,2048
- '
- IF sumtype%=1
- '
- PRINT "----- ---------------- ---------------- -------------------- --------- -----"
- PRINT "Msg # From To Subject Date Attrs"
- PRINT "----- ---------------- ---------------- -------------------- --------- -----"
- PRINT #2,"----- ---------------- ---------------- -------------------- --------- -----"
- PRINT #2,"Msg # From To Subject Date Attrs"
- PRINT #2,"----- ---------------- ---------------- -------------------- --------- -----"
- '
- '
- FOR k%=lowater% TO hiwater%
- spotl%=0
- '
- msghandle$=sourcedir$+STR$(k%)+".MSG"
- @header_load
- IF spotl%
- @getmsgdetails(spotl%)
- '
- fromname$=LEFT$(fromname$,16)
- toname$=LEFT$(toname$,16)
- subject$=LEFT$(subject$,20)
- att$=""
- IF BTST(attribute&,0)
- att$=att$+"P"
- ENDIF
- IF BTST(attribute&,1)
- att$=att$+"C"
- ENDIF
- IF BTST(attribute&,2)
- att$=att$+"R"
- ENDIF
- IF BTST(attribute&,3)
- att$=att$+"S"
- ENDIF
- IF BTST(attribute&,4)
- att$=att$+"A"
- ENDIF
- IF BTST(attribute&,8)
- att$=att$+"L"
- ENDIF
- IF BTST(attribute&,9)
- att$=att$+"H"
- ENDIF
- IF BTST(attribute&,11)
- att$=att$+"F"
- ENDIF
- att$=LEFT$(att$,5)
- '
- @spaceout(STR$(k%),6)
- PRINT STR$(k%)+SPACE$(spc%);
- PRINT #2,STR$(k%)+SPACE$(spc%);
- @spaceout(fromname$,17)
- PRINT fromname$+SPACE$(spc%);
- PRINT #2,fromname$+SPACE$(spc%);
- @spaceout(toname$,17)
- PRINT toname$+SPACE$(spc%);
- PRINT #2,toname$+SPACE$(spc%);
- @spaceout(subject$,21)
- PRINT subject$+SPACE$(spc%);
- PRINT #2,subject$+SPACE$(spc%);
- PRINT LEFT$(dattime$,10);
- PRINT #2,LEFT$(dattime$,10);
- PRINT att$
- PRINT #2,att$
- '
- ENDIF
- '
- onelineclean:
- ' better give us back the memory!
- '
- IF spotl%
- ~FreeMem(spotl%,msglen%+4)
- ENDIF
- spotl%=0
- NEXT k%
- '
- ELSE IF sumtype%=2
- '
- '
- FOR k%=lowater% TO hiwater%
- spotl%=0
- '
- msghandle$=sourcedir$+STR$(k%)+".MSG"
- @header_load
- '
- IF spotl%
- PRINT msghandle$+" found - "+STR$(hiwater%-k%)+" to go - writing "+STR$(msglen%)+" bytes...";
- @getmsgdetails(spotl%)
- '
- PRINT #2,""
- PRINT #2,"---------------------------------------------------------------------------"
- @spaceout(fromname$,36)
- PRINT #2,"From: "+fromname$+SPACE$(spc%);
- PRINT #2,"Message # : "+STR$(k%)+" of "+STR$(hiwater%)
- @spaceout(toname$,36)
- PRINT #2,"To : "+toname$+SPACE$(spc%);
- PRINT #2,"Area : "+sourcedir$
- '
- @spaceout(dattime$,36)
- PRINT #2,"Date: "+dattime$+SPACE$(spc%);
- PRINT #2,"Replies : ";
- '
- IF replyto&>0
- PRINT #2,STR$(replyto&)+" <=- ";
- ENDIF
- PRINT #2,"*";
- IF nextreply&>0
- PRINT #2," -=> "+STR$(nextreply&);
- ENDIF
- PRINT #2,""
- '
- PRINT #2,"Attr:";
- '
- xx$=""
- '
- IF BTST(attribute&,0)
- xx$=xx$+" PRIVT"
- ENDIF
- IF BTST(attribute&,1)
- xx$=xx$+" CRASH"
- ENDIF
- IF BTST(attribute&,2)
- xx$=xx$+" RECD"
- ENDIF
- IF BTST(attribute&,3)
- xx$=xx$+" SENT"
- ENDIF
- IF BTST(attribute&,4)
- xx$=xx$+" FATCH"
- ENDIF
- IF BTST(attribute&,8)
- xx$=xx$+" LOCAL"
- ENDIF
- IF BTST(attribute&,9)
- xx$=xx$+" HOLD"
- ENDIF
- IF BTST(attribute&,11)
- xx$=xx$+" FREQ"
- ENDIF
- '
- IF LEN(xx$)>36
- xx$=LEFT$(xx$,36)
- ELSE IF LEN(xx$)<=1
- xx$=" "
- ENDIF
- @spaceout(xx$,37)
- PRINT #2,xx$+SPACE$(spc%);
- '
- PRINT #2,"Times Read: "+STR$(timesread&)
- '
- xx$=STR$(origzone&)+":"+STR$(orignet&)+"/"+STR$(orignode&)+"."+STR$(origpoint&)
- PRINT #2,"Orig: ";
- @spaceout(xx$,36)
- PRINT #2,xx$+SPACE$(spc%);
- PRINT #2,"Dest'n : ";
- PRINT #2,STR$(destzone&)+":"+STR$(destnet&)+"/"+STR$(destnode&)+"."+STR$(destpoint&)
- '
- PRINT #2,"Subj: "+subject$
- PRINT #2,"---------------------------------------------------------------------------"
- '
- spot2%=AllocMem(msglen%-180,65536)
- '
- IF spot2%=0
- PRINT
- PRINT "Error finding memory - we must be absolutely incredibly low!"
- PRINT ""
- PRINT "If we haven't got enough room for 1 message, that's it! I'm outahere!"
- PRINT
- GOTO msgdropexit
- ENDIF
- '
- i%=0
- FOR kr%=190 TO msglen%
- xq%=PEEK(kr%+spotl%)
- IF (xq%>31) AND (xq%<>141)
- POKE spot2%+i%,xq%
- INC i%
- ENDIF
- IF xq%=1
- POKE spot2%+i%,1
- INC i%
- ENDIF
- IF xq%=13
- POKE spot2%+i%,0
- INC i%
- ENDIF
- NEXT kr%
- '
- msglen.old%=i%
- kr%=0
- '
- WHILE kr%<=msglen.old%
- '
- xx$=CHAR{spot2%+kr%}
- kr%=kr%+LEN(xx$)+1
- '
- IF LEN(xx$)<=79
- IF ASC(xx$)=1
- PRINT #2,"^a"+MID$(xx$,2,4096)
- ELSE IF LEFT$(xx$,8)="SEEN-BY:"
- PRINT #2,"^a"+xx$
- ELSE
- PRINT #2,xx$
- ENDIF
- '
- ELSE
- xx%=RINSTR(xx$," ",79)
- IF xx%=0
- xx%=79
- ENDIF
- WHILE LEN(xx$)>79
- PRINT #2,LEFT$(xx$,xx%)
- xx$=RIGHT$(xx$,LEN(xx$)-xx%)
- xx%=RINSTR(xx$," ",79)
- IF xx%=0
- xx%=79
- ENDIF
- WEND
- '
- IF xx$<>""
- PRINT #2,xx$
- ENDIF
- '
- ' \/ of the byte-by byte analysis
- ENDIF
- '
- ' \/ if there are more bytes in the buffer
- WEND
- '
- msgdropexit:
- ' better give us back the memory!
- '
- IF spot2%
- ~FreeMem(spot2%,msglen%-180)
- spot2%=0
- ENDIF
- IF spotl%
- ~FreeMem(spotl%,msglen%+4)
- spotl%=0
- ENDIF
- PRINT " done!"
- ENDIF
- '
- NEXT k%
- '
- ELSE IF sumtype%=3
- '
- PRINT
- PRINT
- FOR k%=lowater% TO hiwater%
- '
- ar$=""
- PRINT k%;".msg";
- PRINT #2,k%;".msg";
- IF NOT EXIST(sourcedir$+STR$(k%)+".MSG")
- PRINT ", does not exist"
- PRINT #2,", does not exist"
- ELSE
- OPEN "I",#6,sourcedir$+STR$(k%)+".MSG",4096
- SEEK #6,190
- '
- aa$=""
- aa&=0
- '
- DO
- xx%=INP(#6)
- aa$=aa$+CHR$(xx%)
- EXIT IF LEN(aa$)>=5
- EXIT IF EOF(#6)
- LOOP
- '
- ' Find AREA: line if there is one...
- '
- IF LEFT$(aa$,4)="AREA"
- WHILE aa&<>13
- aa&=INP(#6)
- ar$=ar$+CHR$(aa&)
- WEND
- ENDIF
- '
- CLOSE #6
- '
- IF LEFT$(ar$,1)=":"
- ar$=RIGHT$(ar$,LEN(ar$)-1)
- ELSE IF ar$=""
- ar$="None"
- ENDIF
- IF RIGHT$(ar$,1)=CHR$(13)
- ar$=LEFT$(ar$,LEN(ar$)-1)
- ENDIF
- PRINT ", AreaTag: ";ar$
- PRINT #2,", AreaTag: ";ar$
- ENDIF
- NEXT k%
- '
- ENDIF
- '
- CLOSE #2
- '
- finishup:
- PRINT ""
- PRINT "All done! "+versname$+" exiting..."
- ALERT 0,"Exit program",1,"Exit|Quit|Close",xx%
- END
- '
- '
- PROCEDURE getwhatshere(msgarea$)
- LOCAL xx%
- '
- lowater%=2100000000
- hiwater%=2
- nummsgs%=0
- '
- DIR msgarea$ TO "RAM:msgdir"
- IF NOT EXIST("RAM:Msgdir")
- hiwater%=0
- lowater%=0
- nummsgs%=0
- ELSE
- OPEN "I",#3,"RAM:msgdir",4096
- nummsgs%=0
- WHILE NOT EOF(#3)
- LINE INPUT #3,xx$
- xx%=VAL(xx$)
- IF xx%>=2
- INC nummsgs%
- '
- IF xx%<lowater%
- lowater%=xx%
- ENDIF
- IF xx%>hiwater%
- hiwater%=xx%
- ENDIF
- ENDIF
- '
- WEND
- CLOSE #3
- '
- ' extra checks to tidy things up from Plutscan
- '
- IF lowater%=2100000000 AND hiwater%=2
- lowater%=0
- hiwater%=0
- nummsgs%=0
- ENDIF
- IF lowater%>hiwater%
- lowater%=hiwater%
- ENDIF
- '
- ENDIF
- '
- IF EXIST("RAM:Msgdir")
- KILL "RAM:MsgDir"
- ENDIF
- '
- RETURN
- '
- '
- PROCEDURE spaceout(thing$,col%)
- '
- LOCAL xx%,xq%
- '
- ' [Needs the string to format, and the column width it's going to]
- ' [Returns spc% - the number of spaces required - 1 if field overflow]
- '
- xx%=FRE(1)
- xx%=col%
- xq%=LEN(thing$)
- '
- IF xq%>xx%
- result=1
- ELSE
- result=(xx%-xq%)
- ENDIF
- '
- spc%=result
- '
- RETURN
- '
- '
- PROCEDURE header_load
- '
- ' spotl% is the address returned. You must FreeMem(spotl%,msglen%) after
- ' using the data from this function!!!!!!!!
- '
- spotl%=0
- IF EXIST(msghandle$)
- OPEN "I",#7,msghandle$,255
- msglen%=LOF(#7)
- CLOSE #7
- '
- spotl%=AllocMem(msglen%+4,65536)
- '
- IF spotl%=0
- PRINT "Error finding memory - we must be absolutely incredibly low!"
- PRINT "If we haven't got enough room for 1 message, that's it! I'm outahere!"
- END
- ELSE
- '
- xx$=msghandle$+CHR$(0)
- filehand%=Open(V:xx$,1005)
- '
- IF filehand%
- '
- ~Read(filehand%,spotl%,msglen%)
- ~Close(filehand%)
- POKE spotl%+msglen%+1,0
- ENDIF
- ENDIF
- ENDIF
- '
- RETURN
- '
- '
- PROCEDURE getmsgdetails(mem%)
- '
- fromname$=CHAR{mem%+0}
- toname$=CHAR{mem%+36}
- subject$=CHAR{mem%+72}
- IF UPPER$(LEFT$(subject$,3))="RE:"
- subject$=TRIM$(MID$(subject$,4,72))
- ENDIF
- dattime$=CHAR{mem%+144}
- '
- timesread&=BCLR(DPEEK(mem%+164),15)
- destnode&=BCLR(DPEEK(mem%+166),15)
- orignode&=BCLR(DPEEK(mem%+168),15)
- cost&=BCLR(DPEEK(mem%+170),15)
- orignet&=BCLR(DPEEK(mem%+172),15)
- destnet&=BCLR(DPEEK(mem%+174),15)
- destzone&=BCLR(DPEEK(mem%+176),15)
- origzone&=BCLR(DPEEK(mem%+178),15)
- destpoint&=BCLR(DPEEK(mem%+180),15)
- origpoint&=BCLR(DPEEK(mem%+182),15)
- replyto&=BCLR(DPEEK(mem%+184),15)
- attribute&=BCLR(DPEEK(mem%+186),15)
- nextreply&=BCLR(DPEEK(mem%+188),15)
- '
- RETURN
- '
-